package com.hospital.register.dto.core.api;

import com.alibaba.fastjson.JSONObject;
import com.hospital.register.dto.base.ApiBaseDto;
import com.hospital.register.model.core.BookingRule;
import com.hospital.register.validation.groups.InsertValidation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

@Data
@ApiModel(description = "保存医院接口的参数")
public class HospitalSaveDto extends ApiBaseDto {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "医院名称")
    @NotBlank(message = "医院名称不可为空", groups = InsertValidation.class)
    private String hosname;

    @ApiModelProperty(value = "医院类型")
    @NotBlank(message = "医院类型不可为空", groups = InsertValidation.class)
    private String hostype;

    @ApiModelProperty(value = "省code")
    private String provinceCode;

    @ApiModelProperty(value = "市code")
    private String cityCode;

    @ApiModelProperty(value = "区code")
    private String districtCode;

    @ApiModelProperty(value = "详情地址")
    private String address;

    @ApiModelProperty(value = "医院logo")
    private String logoData;

    @ApiModelProperty(value = "医院简介")
    private String intro;

    @ApiModelProperty(value = "坐车路线")
    private String route;

    @ApiModelProperty(value = "预约规则")
    @Valid
    private BookingRule bookingRule;

    public void setBookingRule(String bookingRule) {
        this.bookingRule = JSONObject.parseObject(bookingRule, BookingRule.class);
    }

}

